home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / wasm.arc / CLP.ASM < prev    next >
Encoding:
Assembly Source File  |  1986-02-19  |  4.2 KB  |  91 lines

  1.            TITLE     'Wolfware Sample Program','Clear Part'
  2.  
  3. ;--------------------------------------------------------------------;
  4. ;                         Clear Partial Screen                       ;
  5. ;                                                                    ;
  6. ; BASIC machine language subroutine to scroll or clear the entire    ;
  7. ; screen or just a window within it.                                 ;
  8. ;                                                                    ;
  9. ; Five integer parameters are passed from BASIC to the subroutine:   ;
  10. ; upper row, left column, lower row, right column, and number of     ;
  11. ; lines to scroll up.  Zero lines to scroll means clear the window.  ;
  12. ;                                                                    ;
  13. ; The following is example BASIC implementation, the program having  ;
  14. ; been assembled to the file CLP.BLD:                                ;
  15. ;                                                                    ;
  16. ; 10 DEF SEG                                  'BASIC data segment    ;
  17. ; 20 CLP$ = STRING$(255,0)                    'create string space   ;
  18. ; 30 CLP = VARPTR(CLP$)                       'string descriptor     ;
  19. ; 40 CLP = PEEK(CLP+1) + (PEEK(CLP+2) * 256)  'string data location  ;
  20. ; 50 BLOAD "CLP.BLD",CLP                      'load routine to CLP$  ;
  21. ; 60 '                                                               ;
  22. ; 70 'clear the entire screen                                        ;
  23. ; 80 A%=1:B%=1:C%=25:D%=80:E%=0               'set coordinates       ;
  24. ; 90 CALL CLP(A%,B%,C%,D%,E%)                 'call routine          ;
  25. ; 100 '                                                              ;
  26. ; 110 'scroll a 5 by 5 window in                                     ;
  27. ; 120 'the upper left corner up 2                                    ;
  28. ; 130 A%=1:B%=1:C%=5:D%=5:E%=2                'set coordinates       ;
  29. ; 140 CALL CLP(A%,B%,C%,D%,E%)                'call routine          ;
  30. ;                                                                    ;
  31. ; Due to a quirk of the BIOS function you cannot scroll just one row ;
  32. ; or one column.  The smallest window is two rows by two columns.    ;
  33. ; None of the values are checked, so the BASIC program better better ;
  34. ; make sure they're valid.                                           ;
  35. ;                                                                    ;
  36. ; The object code resulting from assembly is directly BLOADable from ;
  37. ; BASIC.  Since BLOADable programs are not directly executable, it   ;
  38. ; is a good idea not to use COM (the default) as the object file     ;
  39. ; extension.                                                         ;
  40. ;--------------------------------------------------------------------;
  41.  
  42.            PROC      FAR
  43. BLANK_ATR  EQU       07H            ;screen attribute for blanked screen
  44.  
  45. ;----- bload header
  46.  
  47.            ORG       0
  48.            DB        0FDH           ;bload marker
  49.            DW        0F000H,0       ;default load location
  50.            DW        PROGRAM_SIZE   ;size
  51.  
  52. ;----- load upper left row
  53.  
  54.            MOV       BP,SP          ;base for finding parameters
  55.            MOV       SI,[BP+12]     ;parameter location
  56.            MOV       CH,[SI]        ;load
  57.            DEC       CH             ;decrement (make scale 0-24)
  58.  
  59. ;----- load upper left column
  60.  
  61.            MOV       SI,[BP+10]     ;parameter location
  62.            MOV       CL,[SI]        ;load
  63.            DEC       CL             ;decrement
  64.  
  65. ;----- load lower right row
  66.  
  67.            MOV       SI,[BP+8]      ;parameter location
  68.            MOV       DH,[SI]        ;load
  69.            DEC       DH             ;decrement
  70.  
  71. ;----- load lower right column
  72.  
  73.            MOV       SI,[BP+6]      ;parameter location
  74.            MOV       DL,[SI]        ;load
  75.            DEC       DL             ;decrement
  76.  
  77. ;----- load lines to scroll
  78.  
  79.            MOV       SI,[BP+4]      ;parameter location
  80.            MOV       AL,[SI]        ;load
  81.  
  82. ;----- scroll window
  83.  
  84.            MOV       BH,BLANK_ATR   ;attribute for blanked lines
  85.            MOV       AH,6H          ;scroll function
  86.            INT       10H            ;execute
  87.  
  88.            RET       10             ;exit, return to basic
  89.            ENDP
  90. 
  91.